function start(element,col) {
	var fieldString = populateFieldSelect(element);
	$('searchColSelect').innerHTML = fieldString;
	x_getColumnData(col,returnGetColumnData);
}

function populateFieldSelect(element) {
	// TODO: Extract these fields into a PHP global array or something	
	var selectString = null;
	if (element == 'sKeyword') {
		selectString += '<option value="Number" selected>Number</option>';
		selectString += '<option value="Name">Name</option>';
		selectString += '<option value="Acronym">Acronym</option>';
		selectString += '<option value="State">State</option>';
		
		// Remove category: it's just too damn complicated right now
		// and category has it's own search area
		//selectString += '<option value="Category">Category</option>';
		selectString += '<option value="Contact">Contact</option>';
		selectString += '<option value="Summary">Summary</option>';
		selectString += '<option value="Acronym2">Acronym2</option>';		
		selectString += '<option value="Position">Position</option>';
		selectString += '<option value="Contact2">Contact2</option>';
		selectString += '<option value="Contact3">Contact3</option>';
		selectString += '<option value="Contact4">Contact4</option>';
		selectString += '<option value="Notes">Notes</option>';
	} else if (element == 'sName') {
		selectString += '<option value="Name" selected>Name</option>';
		selectString += '<option value="Acronym">Acronym</option>';
		selectString += '<option value="Acronym2">Acronym2</option>';		
		selectString += '<option value="Contact">Contact</option>';
		selectString += '<option value="Contact2">Contact2</option>';
		selectString += '<option value="Contact3">Contact3</option>';
		selectString += '<option value="Contact4">Contact4</option>';
	} else if (element == 'sLocation') {
		selectString += '<option value="State">State</option>';
		selectString += '<option value="State2">State2</option>';
		selectString += '<option value="City">City</option>';
		selectString += '<option value="Country">Country</option>';
		selectString += '<option value="Zip">Zip</option>';
	}
	if (selectString != null) {
		return selectString;
		//selectStringFinal = '<select id="searchField" style="width: 200px;" size="1" onChange="getDlgData(0,this.options[selectedIndex].value)">'+selectString+'</select>';
	} else {
		return false;
	}	
}

function switchColumn(newColumn,sortBy,acdc) {
	x_getColumnData(newColumn,sortBy,acdc,returnGetColumnData);
}

function returnGetColumnData(string) {
	var stringArray = string.split('~|~');
	var column = stringArray[0];
	var data   = stringArray[1];
	$('dataDiv').innerHTML = data;
	$('searchCol').value = column;
}

function sendDataToField(dataRow) {
	var sendData  = dataRow.innerHTML;
	var element   = $('element').value;
	var destField = window.opener.document.getElementById(element);
	var destFieldValue = destField.value;
	if (destFieldValue == '') {
		destField.value = '='+sendData;
	} else {
		destField.value = destFieldValue+'/='+sendData;
	}
}

function getSelectedColumn(input,defaultQS) {
	var searchCol = $('searchCol').value;
	var returnString = defaultQS+'&searchCol='+searchCol
	return returnString;
}
